package com.dly.file;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class StreamPractice {
//	String name="张三";
//	String type="Person";
//	String master;
	public static void main(String[] args) throws IOException {
		
		FileInputStream fis=new FileInputStream("D:/a.txt");
		FileOutputStream fos=new FileOutputStream("D:/b.txt");
		byte[] b=new byte[fis.available()];
		
		fis.read(b);
//		fos.write(b, 0, b.length);
		
		
		String str=new String(b);
		String str2=str.replace("{name}", "张三").replace("type", "狗狗").replace("master", "王五");
		
		byte[] b2=str2.getBytes();
		fos.write(b2);
		fis.close();
		fos.close();
		System.out.println(str2);
	}
}
